{% from 'vote.html' import vote %}

{% extends 'layout.html' %}

{# Set variables for base layour #}
{% set active_page = 'search' %}
{% set title = 'Search' %}

{% block content %}

    <div class="search">
        <form action="/search">
            <p>
                <input type="text" name="q" value="{{ request.query.q or '' }}" placeholder="Search..." required="required" />
                <input type="submit" value="Search" />
            </p>
            <p>
                Order by
                <label>
                    <input type="radio" name="sort" value="newest" {{ 'checked' if not request.query.sort or request.query.sort == 'newest' }}>
                    Most recent
                </label>
                <label>
                    <input type="radio" name="sort" value="points" {{ 'checked' if request.query.sort == 'points' }}>
                    Points
                </label>
            </p>
        </form>
    </div>
    
    {% include 'posts.html' %}

{% endblock %}
